今天我們來製作單據控管系統,利用google sheet作為我們的資料庫,使用GAS做出前端和後端程式碼。
function addInvoice(id, name, amount, note) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Invoices");
sheet.appendRow([new Date(), id, name, amount, "待審核", note]);
}
設定一個function將單據收到sheet裡面
function doGet() {
return HtmlService.createHtmlOutputFromFile('form');
}
使用doGet連接html,並在GAS中新增一個html檔案用以連接。